<template>
  <div class="mod-user">
    <el-dialog
      v-el-drag-dialog
      title="提现详情"
      :visible.sync="visible"
      width="60%">
      <el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
        <el-form-item>
          <el-input v-model="dataForm.keywords" placeholder="提现账户" clearable></el-input>
        </el-form-item>
        <el-form-item>
          <el-date-picker
            v-model="dataForm.time"
            type="datetimerange"
            value-format="yyyy-MM-dd HH:mm:ss"
            format="yyyy-MM-dd HH:mm:ss"
            range-separator="-"
            start-placeholder="开始日期"
            end-placeholder="结束日期">
          </el-date-picker>
        </el-form-item>
        <el-form-item>
          <el-button @click="getDataList()">查询</el-button>
        </el-form-item>
      </el-form>
      <el-table
        :data="dataList"
        border
        v-loading="dataListLoading"
        @selection-change="selectionChangeHandle"
        style="width: 100%;">
        <el-table-column type="expand">
          <template slot-scope="props">
            <el-form label-position="left" inline class="demo-table-expand">
              <el-row :gutter="20">
                <el-col :span="6">
                  <el-form-item label="提现来源：">
                    <span v-if="props.row.withSrc==='0'">
                      安卓
                    </span>
                    <span v-else-if="props.row.withSrc==='1'">
                      苹果
                    </span>
                    <span v-else-if="props.row.withSrc==='2'">
                      小程序
                    </span>
                    <span v-else-if="props.row.withSrc==='3'">
                      后台
                    </span>
                    </el-form-item>
                  </el-col>
                <el-col :span="8">
                  <el-form-item label="处理时间：">
                    <span>{{props.row.handleTime}}</span>
                  </el-form-item>
                </el-col>
                <el-col :span="10">
                  <el-form-item label="代付平台订单号：">
                    <span>{{props.row.trxNo}}</span>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row :gutter="20">
                <el-col :span="6">
                  <el-form-item label="手续费：">
                    <span>{{props.row.withPoundage}}（元）</span>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="提现备注：">
                    <span>{{props.row.cashRemarks}}</span>
                  </el-form-item>
                </el-col>
              </el-row>
            </el-form>
          </template>
        </el-table-column>
        <el-table-column
          prop="withRecordId"
          header-align="center"
          align="center"
          label="ID">
        </el-table-column>
        <el-table-column
          prop="accType"
          header-align="center"
          align="center"
          label="帐号类型">
          <template slot-scope="scope">
            <span>{{scope.row.accType === 0?'银行卡':(scope.row.accType === 1?'微信':'手动')}}</span>
          </template>
        </el-table-column>
        <el-table-column
          prop="accountNo"
          header-align="center"
          align="center"
          label="提现帐号">
        </el-table-column>
        <el-table-column
          prop="money"
          header-align="center"
          align="center"
          label="提现金额">
        </el-table-column>
        <el-table-column
          prop="cashSatus"
          header-align="center"
          align="center"
          width="90"
          label="提现状态">
          <template slot-scope="scope">
            <span v-if="scope.row.cashSatus === 0">提现失败</span>
            <span v-else-if="scope.row.cashSatus === 1">提现成功</span>
            <span v-else-if="scope.row.cashSatus === 2">提现中</span>
            <span v-else-if="scope.row.cashSatus === 3">待审核</span>
            <span v-else-if="scope.row.cashSatus === 4">已审核</span>
            <span v-else-if="scope.row.cashSatus === 5">审核不通过</span>
          </template>
        </el-table-column>
        <el-table-column
          prop="createTime"
          header-align="center"
          align="center"
          label="提现时间">
        </el-table-column>
        <el-table-column
          prop="withUserName"
          header-align="center"
          align="center"
          label="提现用户">
        </el-table-column>
      </el-table>

      <el-pagination
        @size-change="sizeChangeHandle"
        @current-change="currentChangeHandle"
        :current-page="pageIndex"
        :page-sizes="[10, 20, 50, 100]"
        :page-size="pageSize"
        :total="totalPage"
        layout="total, sizes, prev, pager, next, jumper">
      </el-pagination>
    </el-dialog>
  </div>
</template>

<script>
  export default {
    data () {
      return {
        dataForm: {
          keywords: '',
          time: new Date()
        },
        id: 0,
        visible: false,
        dataList: [],
        pageIndex: 1,
        pageSize: 10,
        totalPage: 0,
        dataListLoading: false,
        dataListSelections: [],
        addOrUpdateVisible: false,
        extractMoneyDetailsVisible: false
      }
    },
    components: {
    },
    activated () {
    },
    methods: {
      // 获取数据列表
      getDataList (id) {
        this.visible = true
        if (this.id === 0) {
          this.id = id
        }
        if (id === undefined) {
          id = this.id
        } else {
          this.dataForm.time = new Date()
          console.log(this.dataForm.time)
        }
        this.$http({
          url: this.$http.adornUrl('/member/user/queryExtractMoneyDetailList'),
          method: 'get',
          params: this.$http.adornParams({
            'page': this.pageIndex - 1,
            'limit': this.pageSize,
            'keywords': this.dataForm.keywords,
            'withUserId': id,
            'lastStart': this.dataForm.time[0],
            'lastEnd': this.dataForm.time[1]
          })
        }).then(({data}) => {
          if (data && data.code === 0) {
            this.dataList = data.data.list
            this.totalPage = data.data.totalCount
          } else {
            this.dataList = []
            this.totalPage = 0
          }
          this.dataListLoading = false
        })
      },
      // 每页数
      sizeChangeHandle (val) {
        this.pageSize = val
        this.pageIndex = 1
        this.getDataList()
      },
      // 当前页
      currentChangeHandle (val) {
        this.pageIndex = val
        this.getDataList()
      },
      // 多选
      selectionChangeHandle (val) {
        this.dataListSelections = val
      },
      a (rowIndex) {
        alert(rowIndex)
      }
    }
  }
</script>
<style>
  .characters{
    width:300px;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
  }
  .el-dialog__body {
    height: 500px;
    overflow-y: scroll;
  }
</style>
